package com.young.springdemo.service.flyweigh;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

//@Component
public class TestFlyweigh {

//    @PostConstruct
    public void test(){
        IgoChessman b = IgoFactory.getIgoChessman("b");
        IgoChessman b1 = IgoFactory.getIgoChessman("b");
        IgoChessman w = IgoFactory.getIgoChessman("w");
        IgoChessman w1 = IgoFactory.getIgoChessman("w");
        System.out.println("享元模式"+(b == b1) );
        System.out.println(w == w1);
        b.display(new Coordinates("23","45"));
        b1.display(new Coordinates("235","455"));
        w1.display(new Coordinates("23666","45666"));
        w.display(new Coordinates("23","45"));
    }
}
